    valid = true;
	validForm = [false, false, false, false, false, false, false, false];
	
	submit  = document.getElementById("submit");
	/** cek ke-valid-an nama */
	document.getElementById("nama").addEventListener("blur", namaValidator, false);
	document.getElementById("nama").addEventListener("keydown", namaValidator, false);
	function namaValidator()
	{
		if (validString(document.getElementById("nama").value, /^[a-z A-Z]{5,}$/)) {
			document.getElementById("namaValidator").innerHTML="";
			validForm[0] = true;
		} else {
			document.getElementById("namaValidator").innerHTML="nama minimal terdiri dari 5 karakter yang terdiri dari hanya huruf dan spasi saja";
			validForm[0] = false;
		}
		allowSubmission();
	}
	
	/** cek ke-valid-an username */
	document.getElementById("username").addEventListener("blur", usernameValidator, false);
	document.getElementById("username").addEventListener("keydown", usernameValidator, false);
	function usernameValidator()
	{
		if (validString(document.getElementById("username").value, /^[\w.]{5,}$/)) {
			document.getElementById("usernameValidator").innerHTML="";
			validForm[1] = true;
		} else {
			document.getElementById("usernameValidator").innerHTML="username minimal terdiri dari 5 karakter yang terdiri atas huruf, angka, '_', dan '.' saja";
			validForm[1] = false;
		}
		allowSubmission();
	}
	
	/** cek ke-valid-an password */
	document.getElementById("password").addEventListener("blur", passwordValidator, false);
	document.getElementById("password").addEventListener("keyup", passwordValidator, false);
	function passwordValidator()
	{
		if (validString(document.getElementById("password").value, /.{8,}/)  && (document.getElementById("password").value != document.getElementById("username").value) && (document.getElementById("password").value != document.getElementById("email").value)) {
			document.getElementById("passwordValidator").innerHTML="";
			validForm[2] = true;
		} else {
			document.getElementById("passwordValidator").innerHTML="password minimal terdiri dari 8 karakter, tidak boleh sama dengan email dan username";
			validForm[2] = false;
		}
		allowSubmission();
	}
	
	/** cek ke-valid-an passwordlagi */
	document.getElementById("passwordlagi").addEventListener("blur", passwordlagiValidator, false);
	document.getElementById("passwordlagi").addEventListener("keydown", passwordlagiValidator, false);
	function passwordlagiValidator()
	{
		if (document.getElementById("password").value == document.getElementById("passwordlagi").value) {
			document.getElementById("passwordlagiValidator").innerHTML="";
			validForm[3] = true;
		} else {
			document.getElementById("passwordlagiValidator").innerHTML="password lagi harus sama dengan password";
			validForm[3] = false;
		}
		allowSubmission();
	}
	
	/** cek ke-valid-an tanggalLahir */
	document.getElementById("tanggalLahir").addEventListener("blur", tanggalLahirValidator, false);
	document.getElementById("tanggalLahir").addEventListener("keydown", tanggalLahirValidator, false);
	function tanggalLahirValidator()
	{
		if (validString(document.getElementById("tanggalLahir").value, /\d{4}-\d{2}-\d{2}/)) {
			if (isDate(document.getElementById("tanggalLahir").value)) {
				document.getElementById("tanggalLahirValidator").innerHTML="";
				validForm[4] = true;
			} else {
				document.getElementById("tanggalLahirValidator").innerHTML="tanggal tidak sahih";
				validForm[4] = false;
			}
		} else {
			document.getElementById("tanggalLahirValidator").innerHTML="format penanggalan adalah YYYY-MM-DD";
			validForm[4] = false;
		}
		allowSubmission();
	}
	function getDaysInYear (year) {
		for (var i = 1; i <= 12; ++i) {
			this[i] = 31;
			if ((i == 4) || (i == 6) || (i == 9) || (i == 11)) {
				this[i] = 30;
			}
			else if (i == 2) {
				this[i] = ((((year % 4 == 0) && ! (year % 100 == 0)) || (year % 400 == 0)) ? 29 : 28);
			}
		}
	
		return (this);
	}
	function isDate(strDate) {
		var strYear = strDate.substring(0, 4);
		var strMonth = strDate.substring(5, 7);
		var strDay = strDate.substring(8, 10);
		var year = parseInt(strYear);
		var month = parseInt(strMonth);
		var day = parseInt(strDay);
		var daysInMonth = getDaysInYear(year);
		if (year < 1) {
			return (false);
		}
		if ((month < 1) || (month > 12)) {
			return (false);
		}
		if ((day < 1) || (day > daysInMonth[month])) {
			return (false);
		}
	
		return (true);
	}
	
	/** cek ke-valid-an email */
	document.getElementById("email").addEventListener("blur", emailValidator, false);
	document.getElementById("email").addEventListener("keydown", emailValidator, false);
	function emailValidator()
	{
		if (validString(document.getElementById("email").value, /[\w.]{5,}@[\w.]{2,}\.[\w.]{2,}/)) {
			document.getElementById("emailValidator").innerHTML="";
			validForm[5] = true;
		} else {
			document.getElementById("emailValidator").innerHTML="email minimal terdiri dari 5 karakter yang terdiri atas huruf, angka, '_', dan '.' saja dan diikuti oleh @ domain yang minimum terdiri dari 2 karakter yang terdiri atas huruf, angka, '_', dan '.' saja";
			validForm[5] = false;
		}
		allowSubmission();
		passwordValidator();
		passwordlagiValidator();
	}
	
	/** cek ke-valid-an file */
	document.getElementById("file").addEventListener("blur", fileValidator, false);
	document.getElementById("file").addEventListener("keydown", fileValidator, false);
	document.getElementById("file").addEventListener("click", fileValidator, false);
	document.getElementById("nama").addEventListener("focus", fileValidator, false);
	document.getElementById("username").addEventListener("focus", fileValidator, false);
	document.getElementById("password").addEventListener("focus", fileValidator, false);
	document.getElementById("passwordlagi").addEventListener("focus", fileValidator, false);
	document.getElementById("tanggalLahir").addEventListener("focus", fileValidator, false);
	document.getElementById("email").addEventListener("focus", fileValidator, false);
	function fileValidator()
	{
		var ext = document.getElementById("file").value.match(/\.(.+)$/)[1];
		switch (ext) {
			case 'jpg' :
			case 'jpeg' :
				document.getElementById("fileValidator").innerHTML="";
				validForm[6] = true;
				break;
			default :
				document.getElementById("fileValidator").innerHTML="hanya menerima image file berekstensi .bmp, .jpg, .jpeg, .png";
				validForm[6] = false;
		}
		allowSubmission();
	}
	
	/** cek ke-valid-an gender */
	document.getElementById("gender").addEventListener("blur", genderValidator, false);
	document.getElementById("gender").addEventListener("click", genderValidator, false);
	function genderValidator()
	{
		if (document.getElementById("gender").value != "Pilih Kelamin") {
			document.getElementById("genderValidator").innerHTML="";
			validForm[7] = true;
		} else {
			document.getElementById("genderValidator").innerHTML="Jenis kelamin anda harus diisi";
			validForm[7] = false;
		}
		allowSubmission();
	}
	function validString (str, reg) {
		return (reg.test(str));
	}
	
	function allowSubmission () {
		var valid = true;
		
		for (var i = 0; i < 8; ++i)
			if (! validForm[i])
				valid = false;
		
		if (valid)
			submit.removeAttribute("disabled");
	}
